package com.imu.purse.modules.trade.dao;

import java.util.List;
import org.apache.ibatis.annotations.Select;
import com.imu.purse.modules.trade.entity.FundMergeDetailEntity;
import com.imu.core.base.BaseMapper;

/**
 * 用户资金合并详情表
 * @author sunhongwei
 * @email sunhongwei@jshijian.com
 * @date 2018-07-06 19:40:01
 * Copyright (c) 2017 武汉极时间科技有限公司 版权所有 
 * Jshijian aloha CO.,LTD. All Rights Reserved. 
 */
public interface FundMergeDetailMapper extends BaseMapper<FundMergeDetailEntity>
{
	/**
     * 分页查询
     * @return
     */
	@Select({
		"<script>",
		    "SELECT id,",
					"pay_user_id, ",
					"pay_phone, ",
					"rec_user_id, ",
					"rec_phone, ",
					"order_time, ",
					"create_user, ",
					"remark",
		    "FROM imu_fund_merge_detail ",
		    "WHERE 1=1",
			"<when test = 'payUserId != null'>",
		    	"AND `pay_user_id` = #{payUserId}",
		    "</when>",
			"<when test = 'payPhone != null'>",
		    	"AND `pay_phone` = #{payPhone}",
		    "</when>",
			"<when test = 'recUserId != null'>",
		    	"AND `rec_user_id` = #{recUserId}",
		    "</when>",
			"<when test = 'recPhone != null'>",
		    	"AND `rec_phone` = #{recPhone}",
		    "</when>",
			"<when test = 'orderTime != null'>",
		    	"AND `order_time` = #{orderTime}",
		    "</when>",
			"<when test = 'createUser != null'>",
		    	"AND `create_user` = #{createUser}",
		    "</when>",
			"<when test = 'remark != null'>",
		    	"AND `remark` = #{remark}",
		    "</when>",
		    "<when test = 'stime != null'>",
		    	"AND order_time &gt;= #{stime}",
		    "</when>",
		    "<when test = 'etime != null'>",
				"AND order_time &lt;= #{etime}",
			"</when>",
		    "ORDER BY order_time DESC",
    	"</script>"
	})
    public List<FundMergeDetailEntity> findByPage(final FundMergeDetailEntity entity);	
}
